/**
 * Model Util
 */
class ModelUtil {
  /**
   * number field getter
   * @return {function(column): number}
   */
  static numberGetter() {
    return function(col) {
      return Number(this.getDataValue(col));
    };
  }

  /**
   * timestamp field getter
   * @return {function(column): number}
   */
  static timeGetter() {
    return function(col) {
      return new Date(this.getDataValue(col)).getTime();
    };
  }
}

module.exports = {
  numberGetter: ModelUtil.numberGetter,
  timeGetter: ModelUtil.timeGetter,
};
